from django.conf.urls import url
from rest_framework_jwt.views import obtain_jwt_token

from . import views

urlpatterns = [
    #  查看用户的用户名是否重复
    url(r'^usernames/(?P<username>\w{4,20})/count/$', views.RegisterUsernameCountView.as_view(), name='usernamecount'),
    #  查看用户的手机号是否重复
    url(r'^phones/(?P<mobile>1[345789]\d{9})/count/$', views.RegisterPhonesCountView.as_view(), name='phoneCount'),
    #  实现注册功能，保存到数据库
    url(r'^$', views.RegisterCreateUserView.as_view(), name='create'),
    #  用户登陆
    # url(r'^auths/$', obtain_jwt_token),
    url(r'^auths/$', views.UserAuthorizationView.as_view(), name='auths'),
    #  用户首页信息
    url(r'^infos/$', views.UserCenterView.as_view(), name='infos'),
    url(r'^emails/$', views.UserEmailView.as_view(), name='email'),
    url(r'^emails/verification/$', views.UserActiveEmail.as_view(), name='active'),
    url(r'^addresses/$', views.AddressView.as_view(), name='add'),
    url(r'^getaddresses/$', views.GetAddressView.as_view(), name='add'),
    url(r'^addresses/(?P<pk>\d+)/$', views.DeleteAddressView.as_view(), name='add'),
    url(r'^addresses/(?P<pk>\d+)/title/$', views.UpdateAddressView.as_view(), name='add'),
    url(r'^addresses/(?P<pk>\d+)/status/$', views.DefaultAddressView.as_view(), name='add'),
    url(r'^browerhistories/$', views.UserBrowsingHistoryView.as_view(), name='history')
]
